Skip to content

Add CoreAnimation-style border rendering to Layer#31

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/add-border-rendering-support
Draft

Add CoreAnimation-style border rendering to Layer#31
Copilot wants to merge 5 commits intomainfrom
copilot/add-border-rendering-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 11, 2026

Implements borderWidth and borderColor properties for Layer, matching CoreAnimation's API pattern.

Implementation

  • Layer properties: Added border_width: f32 and border_color: [f32; 4] with RGBA support
  • Shader rendering: Fragment shader detects border region using untransformed pixel positions (0..width, 0..height) and renders border color before base color/texture
  • API methods:
    • set_border(width, r, g, b, a) - width auto-clamps to 0.0 minimum
    • border_width() / border_color() - property getters
  • Uniforms extension: Extended GPU uniform buffer with border parameters and layer dimensions

Usage

let mut layer = Layer::new("layer".to_string(), 200, 200, None);
layer.set_background_color(1.0, 0.0, 0.0);
layer.set_border(5.0, 0.0, 0.0, 0.0, 1.0); // 5px black border

// Semi-transparent borders supported
layer.set_border(3.0, 1.0, 1.0, 1.0, 0.5); // 3px 50% opacity white border

Example added in examples/border_demo.rs demonstrating various border styles, widths, and nesting scenarios.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: joone <1979160+joone@users.noreply.github.com>
@@ -0,0 +1,151 @@
// Copyright (c) 2021 Joone Hur <joone@chromium.org> All rights reserved.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copyright (c) 2026 Joone Hur joone@chromium.org All rights reserved

Copilot AI and others added 3 commits February 11, 2026 02:01
Co-authored-by: joone <1979160+joone@users.noreply.github.com>
…rove example robustness

Co-authored-by: joone <1979160+joone@users.noreply.github.com>
…umentation

Co-authored-by: joone <1979160+joone@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for border rendering to Layer like CoreAnimations Add CoreAnimation-style border rendering to Layer Feb 11, 2026
Copilot AI requested a review from joone February 11, 2026 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants